<template>
  <div class="view">
    <Panel :title="title">
      <div class="courseMain">
        <el-row :gutter="100">
          <el-col :span="24">
            <div class="courseName">
              <span style="color: red">*</span>
              企业名称
            </div>
            <div>
              <el-input v-model="course.name" placeholder="请输入企业名称" />
            </div>
          </el-col>
        </el-row>
        <div class="courseDes">
          <span style="color: red">*</span>
          需要招聘的职位
        </div>
        <div>
          <el-input v-model="course.description" placeholder="请输入需要招聘的职业" />
        </div>
        <div class="courseDes">
          <span style="color: red">*</span>
          薪资待遇
        </div>
        <div>
          <el-input v-model="course.goal" placeholder="请输入相应的薪资待遇" />
        </div>
        <div class="courseDes">
          <span style="color: red">*</span>
          企业的地址
        </div>
        <div>
          <el-input v-model="course.content" placeholder="请输入企业的地址" />
        </div>
        <div class="courseDes">
          <span style="color: red">*</span>
          需要的工作经验
        </div>
        <div>
          <el-input v-model="course.references" placeholder="请输入需要的工作经验" />
        </div>
        <div class="courseDes">
          <span style="color: red">*</span>
          需要的学历要求
        </div>
        <div>
          <el-input v-model="course.xueli" placeholder="请输入需要的学历要求" />
        </div>
        <div class="courseDes">
          招聘海报
        </div>
        <div>
          <simditor v-model="course.haibao" />
        </div>
        <div class="courseButton">
          <save type="primary" @click="saveCourse()">保存</save>
        </div>
      </div>
    </Panel>
  </div>
</template>

<script>
import api from '../../api'
import Simditor from '../../components/Simditor.vue'

export default {
  name: 'CreateCourse',
  components: { Simditor },
  data () {
    return {
      title: '添加招聘信息',
      course: {
        name: '',
        description: '',
        goal: '',
        content: '',
        references: '',
        visible: false,
        xueli: '',
        haibao: ''
      }
    }
  },
  mounted () {
    if (this.$route.name === 'edit-course') {
      this.title = '编辑招聘信息'
      api.getCourse(this.$route.params.courseId).then(res => {
        this.course = res.data.data
      }).catch(() => {
      })
    }
  },
  methods: {
    saveCourse () {
      this.$router.replace('/employ/employList')
      console.log(this.name)
    }
  }
}
</script>
<style scoped>
.courseMain {
  width: 80%;
  margin-left: 10%;
}
.courseName {
  margin-bottom: 15px;
}
.courseType {
  margin-bottom: 15px;
}
.typeSwitch {
  margin-top: 20px;
}
.courseDes {
  margin-top: 30px;
  margin-bottom: 10px;
}
.courseButton {
  margin-top: 20px;
  margin-bottom: 20px;
}
</style>